Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate grad scaler test out from test_app_state_mixin #425

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

daniellepintz
Copy link
Contributor

Summary:
Currently test_app_state_mixin is failing on OSS CI:

self = <framework.test_auto_unit.TestAutoUnit testMethod=test_app_state_mixin>

    def test_app_state_mixin(self) -> None:
        """
        Test that app_state, tracked_optimizers, tracked_lr_schedulers are set as expected with AutoUnit
        """
        my_module = torch.nn.Linear(2, 2)

        auto_unit = DummyAutoUnit(
            module=my_module,
            precision="fp16",
        )

        self.assertEqual(auto_unit.tracked_modules()["module"], my_module)
        self.assertTrue(
            isinstance(
                auto_unit.tracked_misc_statefuls()["grad_scaler"],
                torch.cuda.amp.GradScaler,
            )
        )
        for key in ("module", "optimizer", "lr_scheduler", "grad_scaler"):
>           self.assertTrue(key in auto_unit.app_state())
E           AssertionError: False is not true

tests/framework/test_auto_unit.py:69: AssertionError

https://github.com/pytorch/tnt/actions/runs/5321328919/jobs/9636295932

Differential Revision: D46870935

Summary:
Currently `test_app_state_mixin` is failing on OSS CI:
```
self = <framework.test_auto_unit.TestAutoUnit testMethod=test_app_state_mixin>

    def test_app_state_mixin(self) -> None:
        """
        Test that app_state, tracked_optimizers, tracked_lr_schedulers are set as expected with AutoUnit
        """
        my_module = torch.nn.Linear(2, 2)

        auto_unit = DummyAutoUnit(
            module=my_module,
            precision="fp16",
        )

        self.assertEqual(auto_unit.tracked_modules()["module"], my_module)
        self.assertTrue(
            isinstance(
                auto_unit.tracked_misc_statefuls()["grad_scaler"],
                torch.cuda.amp.GradScaler,
            )
        )
        for key in ("module", "optimizer", "lr_scheduler", "grad_scaler"):
>           self.assertTrue(key in auto_unit.app_state())
E           AssertionError: False is not true

tests/framework/test_auto_unit.py:69: AssertionError
```

https://github.com/pytorch/tnt/actions/runs/5321328919/jobs/9636295932

Differential Revision: D46870935

fbshipit-source-id: f7908384d6f6924f6d9b98984330bd01a0e4b2bb
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D46870935

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants